home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / source.exe / POSIX / SH / STD / STDC / STRCHR.C < prev    next >
C/C++ Source or Header  |  1992-07-13  |  423b  |  22 lines

  1. #include <string.h>
  2.  
  3. /*
  4.  * strchr - find first occurrence of a character in a string
  5.  */
  6.  
  7. char *                /* found char, or NULL if none */
  8. strchr(s, charwanted)
  9. Const char *s;
  10. register char charwanted;
  11. {
  12.     register Const char *scan;
  13.  
  14.     /*
  15.      * The odd placement of the two tests is so NUL is findable.
  16.      */
  17.     for (scan = s; *scan != charwanted;)    /* ++ moved down for opt. */
  18.         if (*scan++ == '\0')
  19.             return(NULL);
  20.     return(scan);
  21. }
  22.